package com.ttloner.mybatis.mapper;

import com.ttloner.mybatis.model.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author TTLoner
 * @date 2021/7/17 12:57
 * @description
 */
@Mapper
public interface UserMapper {
    @Select("select * from user u where u.id = #{u.id}")
    public User selectById(int id);

    @Select("select * from user")
    public List<User> selectAll();

    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into user(id,name,password,address,phone) values(#{id},#{name},#{password},#{address},#{phone})")
    public void insert(User user);

    @Delete("delete from user where id=#{id}")
    public void delete(int id);


}
